UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/UcMEKx5ToS+YeEQ/yMk9fOLI/FaevexyLT2h+Ke80=' 
WHERE 
  key_id = 'bbae8bfc018c87efc0060b7c952239545ea76c2b0ae40787ed07121735251016' 
  AND (
    token = 'p/UcMEKx5ToS+YeEQ/yMk9fOLI/FaevexyLT2h+Ke80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067