UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oD4hBwUdpvbJpyhNq1n01mlYLu6AomW6izPFWNZ03Ws=' 
WHERE 
  key_id = '46eed5d239f884995cac8fd3e7d7666369158f44c959001bc28f8d050244aac9' 
  AND (
    token = 'oD4hBwUdpvbJpyhNq1n01mlYLu6AomW6izPFWNZ03Ws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048