UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+snvQoxyFcLUh8IzSnJbVY2Hzsljd6VBUyCCHXLdzU=' 
WHERE 
  key_id = '8ed43c46a7180a40f50aea5ef37e24a4d9707fe9a72e00b5af18aa73d5feefb3' 
  AND (
    token = 'P+snvQoxyFcLUh8IzSnJbVY2Hzsljd6VBUyCCHXLdzU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045