UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ps2Sa6qgJeBy/53w7hIMzswmwiQAHyKGlw0WYg73V2c=' 
WHERE 
  key_id = '233770731595f27aa687429233c51cc9e89f86357a3f2d33441078f07b18bc31' 
  AND (
    token = 'Ps2Sa6qgJeBy/53w7hIMzswmwiQAHyKGlw0WYg73V2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040