UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rnk+peeUDlQxKAFVTvtp9ih4WtCqiy4cg+0H8LIfxw4=' 
WHERE 
  key_id = '40a13ad6a6e45c2c8dcbe968832ca6c6a6093fb79da116898ddd2f58900db948' 
  AND (
    token = 'rnk+peeUDlQxKAFVTvtp9ih4WtCqiy4cg+0H8LIfxw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038