UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K8pZXoYuJpDAyv0NlWRYBYHh1QyyCozejmDzCW1NR8M=' 
WHERE 
  key_id = 'c2308c5ad3c33bd6e7563b0911463ede30eb26b670124e81b32c85d1b5f4ff99' 
  AND (
    token = 'K8pZXoYuJpDAyv0NlWRYBYHh1QyyCozejmDzCW1NR8M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026