UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wgSJTEF+PgOXITva9eR+glODeiKf6VC4I5m7UGhJlH4=' 
WHERE 
  key_id = '9cbd5c18006b92befd85ec3827340eeaf103bf6118d637ccd875d36095d645e8' 
  AND (
    token = 'wgSJTEF+PgOXITva9eR+glODeiKf6VC4I5m7UGhJlH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027