UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XHGHKPli65gdQ1K40FunnrJuyUVWD3M3TU/U1gJLars=' 
WHERE 
  key_id = '53f04b4d3b38905600cc289dda6d8987eafffe2f534733f4c727ba1cc5decd19' 
  AND (
    token = 'XHGHKPli65gdQ1K40FunnrJuyUVWD3M3TU/U1gJLars=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037