UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i5bTitPOHH9TXvtFcPABn4VC9ZwCrbWe1uF1kOJ3vLw=' 
WHERE 
  key_id = '2a1a5a3af9d97c5fe595c5c6c329ad6f9b977221b10dd68d5cf7538eb8b63853' 
  AND (
    token = 'i5bTitPOHH9TXvtFcPABn4VC9ZwCrbWe1uF1kOJ3vLw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038