UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Gk9vogxha682R6IDRVwJFgjgBtM3GH7N/Z7u5UGIjOw=' 
WHERE 
  key_id = '9487491e1a1c73091c042040ece72376f9ca7421bff4f332b26875b103008537' 
  AND (
    token = 'Gk9vogxha682R6IDRVwJFgjgBtM3GH7N/Z7u5UGIjOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017