UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JYMapb2O1GiRQg7WCHWGM+OUVEmto7ZwjYRueTuAFss=' 
WHERE 
  key_id = '637a8a4eac6f1a045b8a030dfd18787835dbbb0cd1f15aaa1489183a12bf5a42' 
  AND (
    token = 'JYMapb2O1GiRQg7WCHWGM+OUVEmto7ZwjYRueTuAFss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016