UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8pGWYGUJpzQPHzrN4KOkC362TWvMeo9SH9P2nddqlaM=' 
WHERE 
  key_id = '5d5b3ac312720409e42d50fe40d95d1d69424a4f8343f4e2ceb59ef5ba939051' 
  AND (
    token = '8pGWYGUJpzQPHzrN4KOkC362TWvMeo9SH9P2nddqlaM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047