UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'STIldJQdyIz9Pnyeq/60JQV2Rhw4Qv6Qb0oxOMBflM4=' 
WHERE 
  key_id = '4579d8f1e44e1be63faa6e1a71ed08c1849f0745a60ddb2681384ce7ca0d1e57' 
  AND (
    token = 'STIldJQdyIz9Pnyeq/60JQV2Rhw4Qv6Qb0oxOMBflM4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038