UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zc46LRBETPqAeMLsOZtLaGNcTerQXMdBt+6cuU73lWA=' 
WHERE 
  key_id = 'ec9801e4b8963d7d595ad3bc4bdb102c34c53282af42051c0ec1fd8abcbdb26e' 
  AND (
    token = 'zc46LRBETPqAeMLsOZtLaGNcTerQXMdBt+6cuU73lWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027