UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bpfb9Pu12TJxqFy3/aJM5Kk2qqkgOyMhvP4hiCDzd/M=' 
WHERE 
  key_id = '865d75d84bf2bbc8033ab6939f280d15017b832042bfb4118a0ee1db1132215a' 
  AND (
    token = 'Bpfb9Pu12TJxqFy3/aJM5Kk2qqkgOyMhvP4hiCDzd/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038