UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eBa1oqPQ0UAm34UwGrYPiBdfpXz23CFQgqD4iNgDLO8=' 
WHERE 
  key_id = '2472feb2080fe8691e6a87657a1bd9abc506c3de2099e37bebca8d0623a7b266' 
  AND (
    token = 'eBa1oqPQ0UAm34UwGrYPiBdfpXz23CFQgqD4iNgDLO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025