UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nc9qGTS++++t7AJAOLRtga5pSvVyPLhCWCEAsKbSnKQ=' 
WHERE 
  key_id = '5032eb5472484ca2d9c61d507ca3885815d3be76ee5ad757c33ea0bdb9a3a2a0' 
  AND (
    token = 'Nc9qGTS++++t7AJAOLRtga5pSvVyPLhCWCEAsKbSnKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058