UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5xpAnAn9TeqSX6M+315jS0hpdzJ+thxLb5Y5z/fKT4=' 
WHERE 
  key_id = '2f95c6a36ed60a9cec1265fb2b35b112236ca70639e75f92d589e65930ced12e' 
  AND (
    token = 'D5xpAnAn9TeqSX6M+315jS0hpdzJ+thxLb5Y5z/fKT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034