UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mL8zfTXqaYmKtZG0Q+1+Te+/YVj93bkob+bwNQR04TY=' 
WHERE 
  key_id = '3510f0353ab7386f0bda1c4d52e0641782888278b744abd43a789d5e6fd7a3e1' 
  AND (
    token = 'mL8zfTXqaYmKtZG0Q+1+Te+/YVj93bkob+bwNQR04TY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049