UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IW1eoLL+Ltbk2w8Hiy42vXsc6z177rLE6isvpcLhEIo=' 
WHERE 
  key_id = '449823947613ada3533b794dc3163dfa4aa508c9654daeafaecb2dc822ed4538' 
  AND (
    token = 'IW1eoLL+Ltbk2w8Hiy42vXsc6z177rLE6isvpcLhEIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043