UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K27G3ytf8xzSoxG3ijEuYhVeCcnBXKyq5lB9QwaKgvc=' 
WHERE 
  key_id = '87b821c66d650132bf7450a0503aa988f217020fc18074be9a0afc04792d5e0c' 
  AND (
    token = 'K27G3ytf8xzSoxG3ijEuYhVeCcnBXKyq5lB9QwaKgvc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034