UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nPtMRXnAVYk0Ts0JzPUiosyzEqYMiaUyX65Uo/ShgNw=' 
WHERE 
  key_id = 'a1efc9944d84fc0749ce9a0c12e7f72c6078368817b2e36265aee5657adcecd3' 
  AND (
    token = 'nPtMRXnAVYk0Ts0JzPUiosyzEqYMiaUyX65Uo/ShgNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053