UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sS47L2tIKhOW39CnxT8MXf2N5ikY3JV9dBNqDQuyqkU=' 
WHERE 
  key_id = '79cd9c62f21faadf941c280d92e22e597589d46b8d16d53c22c6f4210b6433f7' 
  AND (
    token = 'sS47L2tIKhOW39CnxT8MXf2N5ikY3JV9dBNqDQuyqkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017